<?php
App::uses('AppController', 'Controller');

class TestController extends AppController {

/**
 * This controller does not use a model
 *
 * @var array
 */
    public $uses = array('Content', 'Category');
/**
 * Displays a view
 *
 * @param mixed What page to display
 * @return void
 * @throws NotFoundException When the view file could not be found
 *	or MissingViewException in debug mode.
 */
	public function index() 
    {
        $sessionTimeStamp = Security::hash(date('Y-m-dH:i:s') . rand(5, 15), 'sha1', true);
		$this->Session->write('Session.timestamp.register.' . $sessionTimeStamp, 1);
        
		$dataList = $this->Content->find('all');
		foreach($dataList as $data) 
		{
			if($data['Content']['category_id'] == 1) {
				$intro = $data; //get data for introduce
			}
			
			else if($data['Content']['category_id'] == 2) {
				$activity  = $data; //get data for activity
			}
			
			else if($data['Content']['category_id'] == 3) {
				$artists = $data; //get data artist
			}
			
			else if($data['Content']['category_id'] == 4) {
				$uniform  = $data; //get data for uniform
			}
			
			else if($data['Content']['category_id'] == 5) {
				$campaignForWomen = $data; //get data for campaign for women
			}
			
			else if($data['Content']['category_id'] == 6) {
				$partner = $data; //get data for partner
			}
			
			else if($data['Content']['category_id'] == 7) {
				$map = $data; //get data for area ngay hoi hong
			}
            
            else if($data['Content']['category_id'] == 8) {
				$copyright = $data; //get data for copyright
			}
		}
		
		$lang = $this->Session->read('Config.language');
		$code='';
		if($lang == 'eng') $code ='_eng';
		$this->set('code', $code);
		$this->set(compact('artists', 'intro', 'map', 'activity', 'uniform', 'campaignForWomen', 'partner', 'sessionTimeStamp', 'copyright'));
	}
}
